<?php

require_once PATH_FFWD.'core/helpers.php';

class BaseObject{
	protected $data=Array();
	protected $instancename;
	
	public function __construct($p){
		if(is_array($p)){
			$this->data=$p;
		}else{
			$this->instancename=$p;
		}
	}
	
	public function __destruct(){
		unset($this->data);
	}
	
	public function __get($k){
		if(isset($this->data[$k]))return $this->data[$k];
		return NULL;
	}
	
	public function __set($k,$v){
		$this->data[$k]=$v;
	}
	
	public function __toString(){
		return $this->name.'::'.__CLASS__;
	}
	
	public function __call($funcname,$params){
		throw new Exception("Method '$funcname' does not exist");
	}

}
